package com.hsd.znsh.repository;

import com.hsd.znsh.entity.Batch;
import com.hsd.znsh.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/*
 * @auther: wangjiacai
 *
 * @create: 2018-04-23 11:54:50
 */
public interface BatchRepository extends JpaRepository<Batch,Integer> {

    List<Batch> findByHostIdOrderByBatchSnDesc(Integer hostId);

    List<Batch> findByHostIdInOrderByBatchSnDesc(List<Integer> hostIds);

    @Query("select max(batchSn) from Batch where hostId=?1")
    String findMaxBatchSnByHostId(Integer hostId);
}
